package com.nthink.indicators.service.qualitymanagement.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nthink.indicators.mapper.qualitymanagement.ClinicalPathwayMapper;
import com.nthink.indicators.pojo.pie.PieDataModel;
import com.nthink.indicators.pojo.qualitymanagement.ClinicalPathway;
import com.nthink.indicators.service.qualitymanagement.ClinicalPathwayService;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ClinicalPathwayServiceImpl extends ServiceImpl<ClinicalPathwayMapper, ClinicalPathway> implements ClinicalPathwayService {

    @Override
    public ClinicalPathway getClinicalPathway(Date startTime, Date endTime) {
        ClinicalPathway clinicalPathway = new ClinicalPathway();

        clinicalPathway.setTypeCount(baseMapper.getTypeCount());
        clinicalPathway.setTotalCount(baseMapper.getTotalCount(startTime, endTime));
        clinicalPathway.setCompleteCount(baseMapper.getCompleteCount(startTime, endTime));
        clinicalPathway.setVariationCount(baseMapper.getVariationCount(startTime, endTime));
        clinicalPathway.setExitCount(baseMapper.getExitCount(startTime, endTime));
        clinicalPathway.setNotCount(baseMapper.getNotCount(startTime, endTime));

        clinicalPathway.setAvgInCount(baseMapper.getAvgInCount(startTime, endTime));
        clinicalPathway.setAvgFee(baseMapper.getAvgFee(startTime, endTime));
        clinicalPathway.setDeathRate(baseMapper.getDeathRate(startTime, endTime));

        return clinicalPathway;
    }

    @Override
    public List<PieDataModel> getDiagnosisInfo(Date startTime, Date endTime) {
        return baseMapper.getDiagnosisInfo(startTime, endTime);
    }

    @Override
    public List<PieDataModel> getCateInfo(Date startTime, Date endTime) {
        return baseMapper.getCateInfo(startTime, endTime);
    }
}
